package com.example.thtnandroidbytopics;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;

public class MainActivityTopics extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		String[] listTopics = new String[] { "01 ListView", "02. Layouts",
				"03. MrTips","04. ActionBar" };
		ListAdapter adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, listTopics);
		setListAdapter(adapter);
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
		switch (position) {
		case 0: // 01 ListView
			startActivity(new Intent(this, ListViewCustom1.class));
			break;
		case 1: // 02. Layouts
			startActivity(new Intent(this, T02Layouts.class));
			break;
		case 2: // 03. MrTips
			startActivity(new Intent(this, T03MrTips.class));
			break;
		case 3: // 04. MrTips
			startActivity(new Intent(this, T04ActionBar.class));
			break;
		default:
			break;
		}

	}

}
